package com.camps.sdk.encrypt;

import com.camps.sdk.common.ExceptionCode;
import com.camps.sdk.entity.MonitorPhone;
import com.camps.sdk.exception.BaseException;

/**
 * @Author ldaoliang
 * @Date create in 10:11 2021/9/1
 * @Description
 */
public class SetMonitorPhoneCommand implements BuildCommand {
    @Override
    public String splicingParameters(String imei, Object params) {
        if(!(params instanceof MonitorPhone)){
            throw new BaseException(ExceptionCode.PARAMETER_ERROR);
        }
        MonitorPhone monitorPhone = (MonitorPhone)params;
        String phone = monitorPhone.getPhone();
        String commandNumber = monitorPhone.getCommandNumber();
        StringBuilder sb = new StringBuilder("*WT,");
        sb = sb.append(imei).append(",MONITOR,").append(commandNumber).append(",").append(phone).append("#");
        return sb.toString();
    }
}
